<template>
	<view>
		<view class="container">
			<view class="box1">
				<image :src="complain_image" class="img_helpyou" mode="aspectFill"></image>
				<view class="content">
					<view class="title1">帮助与反馈</view>
					<view class="ttile2">请留下您的意见和建议，我们会及时联系您</view>
				</view>
			</view>
			<textarea @input="contentFun" :value="content" placeholder="请输入你的反馈" placeholder-class="colc"></textarea>
			<input type="number" maxlength="11" @input="mobile" :value="mobile" placeholder="请输入你的手机号码"
				placeholder-class="colc"></input>
			<view class="btnbox">
				<button class="submit" @tap="submit">确认提交</button>
			</view>
		</view>

	</view>
</template>

<script>
	const app = getApp();

	const functions = require('../../../utils/functions.js');

	export default {
		data() {
			return {
				content: '',
				mobile: '',
				complain_image: ''
			};
		},
		
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {
			var mobile = uni.getStorageSync('mobile') || '';
			this.mobile = mobile;
			this.complain_image = app.globalData.config.complain_image;
			

		},
	
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {},
		methods: {
			submit() {
				var that = this;
				var json = {
					content: this.content,
					//
					mobile: this.mobile //
				};

				if (!this.content) {
					functions.toast('请输入您的意见和建议');
					return false;
				}

				if (!this.mobile || this.mobile.length != 11) {
					functions.toast('请输入您的手机号');
					return false;
				}

				app.globalData.nowThat = this;
				functions.checkLogin(function(ret) {
					if (ret) {
						//继续提交
						functions.submitAjaxData(that, '/api/xiluhouse/User/feedback', json, function(res) {
							
							functions.showSuccess(res.msg,function(){
								uni.navigateBack();
							});
						});
					} else {
						functions.toast('请先登录');
					}
				});
			},

			contentFun(e) {
				this.content = e.detail.value

			},

			mobile(e) {
				this.mobile = e.detail.value

			},

			bindAuthorizeToggle() {
				console.log('占位：函数 bindAuthorizeToggle 未声明');
			}
		}
	};
</script>

<style lang="scss" scoped>
	.box1 {
		width: 750rpx;
		height: 380rpx;
		position: relative;
		z-index: 1;
	}

	.img_helpyou {
		width: 750rpx;
		height: 380rpx;
	}

	.content {
		width: 750rpx;
		height: 380rpx;
		position: absolute;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, .3);
		color: #fff;
		text-align: center;
		padding-top: 70rpx;
		z-index: 2;
	}

	.content .title1 {
		font-size: 50rpx;
		line-height: 67rpx;
		margin-bottom: 15rpx;
	}

	.content .title2 {
		font-size: 24rpx;
		line-height: 34rpx;
	}

	textarea {
		margin: -141rpx 40rpx 0;
		background: #fff;
		border-radius: 15rpx;
		padding: 30rpx;
		position: relative;
		z-index: 3;
		width: 670rpx;
		box-shadow: 0 4rpx 30rpx rgba(184, 189, 202, 0.3);
		height: 400rpx;
	}

	input {
		margin: 30rpx 40rpx 0;
		border-radius: 50rpx;
		box-shadow: 0 4rpx 30rpx rgba(184, 189, 202, 0.3);
		background: #fff;
		height: 90rpx;
		padding: 0 30rpx;
	}



	.btnbox {
		position: absolute;
		bottom: 60rpx;
		left: 40rpx;
		right: 40rpx;
	}

	.btnbox .submit {
		padding: 0;
		margin: 0;
		width: 100%;
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		color: #fff;
		font-weight: normal;
		border-radius: 51rpx;
		background: #0091ff;
		box-shadow: 0rpx 4rpx 40rpx rgba(3, 103, 179, 0.3);
		font-size: 30rpx;
	}
</style>
